package com.neu.flashmall.ms.controller;

import com.neu.common.to.AuthorityCheckTo;
import com.neu.common.utils.Result;
import com.neu.flashmall.ms.service.AuthorityCheckService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@RequestMapping(value = "/authority")
public class AuthorityCheckController {
    @Resource
    private AuthorityCheckService authorityCheckService;

    @PostMapping(value = "/toCheck")
    public Result authorityCheck(@RequestBody AuthorityCheckTo authorityCheckTo) throws IOException {
        boolean result = this.authorityCheckService.check(authorityCheckTo.getUrl(), authorityCheckTo.getToken());
        return Result.ok().put(result);
    }


}
